package com.example.guiguihomemedical.controller;

import com.example.guiguihomemedical.common.Result;
import com.example.guiguihomemedical.entity.Serviceitems;
import com.example.guiguihomemedical.entity.ServiceitemsDescription;
import com.example.guiguihomemedical.entity.dto.FulfillmentservicedetailData;
import com.example.guiguihomemedical.entity.dto.ServicePackServiceitems;
import com.example.guiguihomemedical.service.ServiceitemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("Serviceitems")
public class ServiceitemsController {
    @Autowired
    private ServiceitemsService serviceitemsService;
    @GetMapping
    public Result getServiceitemsList(){
        List<Serviceitems> ServiceitemsList=serviceitemsService.findAllServiceitems();
        return Result.success(ServiceitemsList);
    }
    @GetMapping("/description")
    public Result getServiceitemsDescriptionList(){
        List<ServicePackServiceitems> serviceitemsDescriptionList = serviceitemsService.groupServiceitemsByServicePackId();
        return Result.success(serviceitemsDescriptionList);
    }
    @GetMapping("/description/{id}/{Filtervalues}")
    public Result getServiceitemsDescriptionListById(@PathVariable String id,@PathVariable String Filtervalues){
        List<FulfillmentservicedetailData> serviceitemsDescriptionList = serviceitemsService.SbyIdgroupServiceitemsByServicePackId(id, Integer.parseInt(Filtervalues));
        return Result.success(serviceitemsDescriptionList);
    }
}
